<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Ajax_model extends MY_Model {
	private $_table = "post_bad";
	
	function __contruct(){
        parent::__construct();
    }
	
	public function save($data, $id = FALSE) {
       
        if ($id == FALSE) {
            
            // This is an insert
            $this->db->insert($this->_table,$data);
        }
        else {
            
            // This is an update
            $filter = $this->primaryFilter;
			$this->db->where($this->primary_key, $filter($id));
			$this->db->update($this->_table, $data);
        }
        // Return the ID
        return $id == FALSE ? $this->db->insert_id() : $id;
    }
}